package com.newcamping.campfacility.service.impl;

import java.util.List;
import java.util.UUID;

import com.newcamping.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.newcamping.campfacility.mapper.CampFacilityMapper;
import com.newcamping.campfacility.domain.CampFacility;
import com.newcamping.campfacility.service.ICampFacilityService;

/**
 * 营地服务设施记录Service业务层处理
 * 
 * @author zjz
 * @date 2024-11-16
 */
@Service
public class CampFacilityServiceImpl implements ICampFacilityService 
{
    @Autowired
    private CampFacilityMapper campFacilityMapper;

    /**
     * 查询营地服务设施记录
     * 
     * @param cfId 营地服务设施记录主键
     * @return 营地服务设施记录
     */
    @Override
    public CampFacility selectCampFacilityByCfId(String cfId)
    {
        return campFacilityMapper.selectCampFacilityByCfId(cfId);
    }

    /**
     * 查询营地服务设施记录列表
     * 
     * @param campFacility 营地服务设施记录
     * @return 营地服务设施记录
     */
    @Override
    public List<CampFacility> selectCampFacilityList(CampFacility campFacility)
    {
        return campFacilityMapper.selectCampFacilityList(campFacility);
    }

    /**
     * 新增营地服务设施记录
     * 
     * @param campFacility 营地服务设施记录
     * @return 结果
     */
    @Override
    public int insertCampFacility(CampFacility campFacility)
    {
        //设置uuid
        campFacility.setCfId(UUID.randomUUID().toString());
        campFacility.setCreateTime(DateUtils.getNowDate());
        return campFacilityMapper.insertCampFacility(campFacility);
    }

    /**
     * 修改营地服务设施记录
     * 
     * @param campFacility 营地服务设施记录
     * @return 结果
     */
    @Override
    public int updateCampFacility(CampFacility campFacility)
    {
        campFacility.setUpdateTime(DateUtils.getNowDate());
        return campFacilityMapper.updateCampFacility(campFacility);
    }

    /**
     * 批量删除营地服务设施记录
     * 
     * @param cfIds 需要删除的营地服务设施记录主键
     * @return 结果
     */
    @Override
    public int deleteCampFacilityByCfIds(String[] cfIds)
    {
        return campFacilityMapper.deleteCampFacilityByCfIds(cfIds);
    }

    /**
     * 删除营地服务设施记录信息
     * 
     * @param cfId 营地服务设施记录主键
     * @return 结果
     */
    @Override
    public int deleteCampFacilityByCfId(String cfId)
    {
        return campFacilityMapper.deleteCampFacilityByCfId(cfId);
    }
}
